<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">


    <ui:composition template="/index.xhtml">
        <ui:define name="title"/>
        <ui:define name="body">

            <h:form>
                <p:panel id="panel" header="#{bundle.CreateTblPersonaTitle}" style="margin-bottom:5px;">

                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>

                    <h:panelGrid columns="3" cellpadding="3">
                        <p:outputLabel value="#{bundle.CreateTblPersonaLabel_documento}" for="documento" />
                        <p:inputText id="documento" value="#{tblPersonaController.selected.documento}" title="#{bundle.CreateTblPersonaTitle_documento}" required="true" requiredMessage="#{bundle.CreateTblPersonaRequiredMessage_documento}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="documento" />  

                        <p:outputLabel value="#{bundle.CreateTblPersonaLabel_nombre}" for="nombre" />
                        <p:inputText id="nombre" value="#{tblPersonaController.selected.nombre}" title="#{bundle.CreateTblPersonaTitle_nombre}" required="true" requiredMessage="#{bundle.CreateTblPersonaRequiredMessage_nombre}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="nombre" />

                        <p:outputLabel value="#{bundle.CreateTblPersonaLabel_apellido1}" for="apellido1" />
                        <p:inputText id="apellido1" value="#{tblPersonaController.selected.apellido1}" title="#{bundle.CreateTblPersonaTitle_apellido1}" required="true" requiredMessage="#{bundle.CreateTblPersonaRequiredMessage_apellido1}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="apellido1" />

                        <p:outputLabel value="#{bundle.CreateTblPersonaLabel_apellido2}" for="apellido2" />
                        <p:inputText id="apellido2" value="#{tblPersonaController.selected.apellido2}" title="#{bundle.CreateTblPersonaTitle_apellido2}" />
                        <p:separator/>

                        <p:outputLabel value="#{bundle.CreateTblPersonaLabel_email}" for="email" />
                        <p:inputText id="email" value="#{tblPersonaController.selected.email}" title="#{bundle.CreateTblPersonaTitle_email}" >
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="email"/>

                        <p:outputLabel value="#{bundle.CreateTblPersonaLabel_telefono}" for="telefono" />
                        <p:inputText id="telefono" value="#{tblPersonaController.selected.telefono}" title="#{bundle.CreateTblPersonaTitle_telefono}" required="true" requiredMessage="#{bundle.CreateTblPersonaRequiredMessage_telefono}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="telefono" />

                        <p:outputLabel value="#{bundle.CreateTblPersonaLabel_celular}" for="celular" />
                        <p:inputText id="celular" value="#{tblPersonaController.selected.celular}" title="#{bundle.CreateTblPersonaTitle_celular}" required="true" requiredMessage="#{bundle.CreateTblPersonaRequiredMessage_celular}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="celular" />

                        <p:outputLabel value="#{bundle.CreateTblPersonaLabel_direccion}" for="direccion" />
                        <p:inputText id="direccion" value="#{tblPersonaController.selected.direccion}" title="#{bundle.CreateTblPersonaTitle_direccion}" required="true" requiredMessage="#{bundle.CreateTblPersonaRequiredMessage_direccion}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="direccion" />

                    </h:panelGrid>

                    <p:commandButton action="#{tblPersonaController.create}" value="#{bundle.CreateTblPersonaSaveLink}" update="panel" icon="ui-icon-plus" style="margin:0" />
                    <p:commandButton action="#{tblPersonaController.prepareList}" value="#{bundle.CreateTblPersonaShowAllLink}" immediate="true" icon="ui-icon-check"/>

                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
